var stepId = $CertusJsonAjax.getStepInstanceId();
var processId = $CertusJsonAjax.getProInstanceId();
$CertusFormAjax.ajax("findFyBudget",{"processId":processId},function(response){
    var data = response.data;
    $$scope.proName = data.pro_name;
    $$scope.userName = data.user_name;
    $$scope.proStage = data.pro_phase;
    $$scope.totalMoney = data.total_money;
    $$scope.createTime = data.create_time;
    $$scope.opinionMsg = data.zj_option;
    $$scope.id = data.id;
});
$CertusFormAjax.ajax("findBugetInfo3",{"processId":processId},function (response) {
    var other1Columns = [{
        id: 'buget_phase',
        title: '阶段',
        type: 'string',
        columnClass: 'text-center',
    },{
        id: 'buget_type',
        title: '预算类型',
        type: 'string',
        columnClass: 'text-center',
    }, {
        id: 'buget',
        title: '预算金额',
        type: 'string',
        columnClass: 'text-center',
        resolution: function (value, record, column, grid, dataNo, columnNo) {
            var content = '￥' + value + '元';
            return content;
          }
    },{
        id: 'user_name',
        title: '申请人',
        type: 'string',
        columnClass: 'text-center'
    },{
        id: 'create_time',
        title: '申请时间',
        type: 'date',
        format:'yyyy-MM-dd',
        otype:'time_stamp_ms',
        columnClass: 'text-center'
    },{
        id: 'budget_begin',
        title: '使用周期',
        type: 'string',
        columnClass: 'text-center',
        resolution: function (value, record, column, grid, dataNo, columnNo) {
            var content = '';
            content += record.budgetBegin+"至"+record.budgetEnd;
            return content;
        }
    },{
        id: 'comments',
        title: '费用说明',
        type: 'string',
        columnClass: 'text-center'
    }];
    var other1Option = {
        lang: 'zh-cn',
        ajaxLoad: false,
        extraWidth: 20,
        // loadURL:'url',
        exportFileName: '其他费用',
        datas: response.data,
        columns: other1Columns,
        gridContainer: 'other2Container',
        tools: ''
    };
    var other1Grid = $.fn.dlshouwen.grid.init(other1Option);
    other1Grid.load();
});

$(".rback").on('click',function () {
    $CertusFormAjax.ajax("rhoFyBudget",{"id":$$scope.id,"optionMsg":$("#opinionMsg").val(),"processId":processId,"stepId":stepId},function () {
        layer.msg("退回成功");
        window.history.back();
    })
});
$(".unagree").on('click',function () {
    $CertusFormAjax.ajax("unagreeFysq",{"id":$$scope.id,"optionMsg":$("#opinionMsg").val(),"stepId":stepId},function () {
        layer.msg("审批成功");
        window.history.back();
    })
});
$(".agree").on('click',function () {
    $CertusFormAjax.ajax("agreeFysq",{"id":$$scope.id,"optionMsg":$("#opinionMsg").val(),
        "stepId":stepId,"flag":"3"},function () {
        layer.msg("审批成功");
        window.history.back();
    })
})